﻿#include<iostream>
#include<conio.h>
#include"基本界面.h"
#include"辅助函数.h"
using namespace std;

#include<stdio.h>
#include<Windows.h>


void showHPBar(bool inst, int change)
{
	char hpstyle = '/';
	setColor(12);
	gotoxy(4, 2);
	for (int i = 0; i < 48; i++)
	{
		cout << hpstyle;
		Sleep(30);
		if (i == (48 / 3))
		{
			setColor(14);
			gotoxy(4, 2);
			for (int j = 0; j <= i; j++)
			{
				cout << hpstyle;
			}
		}

		if (i == 48 / 2)
		{
			setColor(10);
			gotoxy(4, 2);
			for (int j = 0; j <= i; j++)
			{
				cout << hpstyle;
			}
		}
	}
	setColor(15);
}

void changeHP(int num)
{
	
	
}


void ctrl()
{
	while (1)
	{
		if (_kbhit())
		{
			char ch = _getch();
			switch (ch)
			{
			case 37:
			case 38:
				changeHP(-1);
			default:
				break;
			}
		}
	}
}


void test()
{
	//界面区

	BoxBd mainbox(0, 0, 150, 45, 1);
	mainbox.print();
	
	BoxBd ctbox(35, 20, 50, 15, 1);
	ctbox.print();

	COORD sp = { 3,1 };
	CornerStyle cstyle('-','-','-','-');
	BorderStyle bstyle('/', '|', '-', '-');
	BoxBd box(sp, 50, 3, 1);
	box.border_show.set(1, 1, 0, 0);
	box.corner_style.set(cstyle);
	box.border_style.set('[', '/', '-', '-');
	box.corner_show.right_down = 0;
	box.print();

	showHPBar(1,1);

	


	cout << endl << endl << endl;
	_getch();
}

void initWnd()
{
	system("mode con cols=150 lines=45  ");
	HWND hwnd = GetConsoleWindow();
	LONG style = GetWindowLongPtrW(hwnd, GWL_STYLE);
	style &= ~(WS_MAXIMIZEBOX);
	style &= ~(WS_SIZEBOX);                             
	SetWindowLong(hwnd, GWL_STYLE, style);
	ReleaseDC(hwnd, NULL);

}

int main()
{
	initWnd();
	test();
	return 0;
}